Ensure pixbufs as entry icons get resized
authorCarlos Garnacho <carlos@lanedo.com>
Fri, 13 Jul 2012 13:55:44 +0000 (15:55 +0200)
committerCarlos Garnacho <carlos@lanedo.com>
Fri, 13 Jul 2012 14:56:37 +0000 (16:56 +0200)
Entries don't expand vertically if they are given pixbufs larger
than the calculated height for the current font, resulting in
cropped icons, so force the pixbuf to be rescaled so it fits
on the entry allocated size.

https://bugzilla.gnome.org/show_bug.cgi?id=678087

gtk/gtkentry.c

index db83f058d46e8f60d7e5bbbd2532f77fc5f32f8f..335cb0ffe29d688428c2dfb2ae6922985efd2b0a 100644 (file)
@@ -2910,6 +2910,7 @@ construct_icon_info (GtkWidget            *widget,
   priv->icons[icon_pos] = icon_info;
 
   icon_info->icon_helper = _gtk_icon_helper_new ();
+  _gtk_icon_helper_set_force_scale_pixbuf (icon_info->icon_helper, TRUE);
 
   if (gtk_widget_get_realized (widget))
     realize_icon_info (widget, icon_pos);
@@ -7620,6 +7621,8 @@ gtk_entry_set_icon_from_pixbuf (GtkEntry             *entry,
   if (pixbuf)
     {
       _gtk_icon_helper_set_pixbuf (icon_info->icon_helper, pixbuf);
+      _gtk_icon_helper_set_icon_size (icon_info->icon_helper,
+                                      GTK_ICON_SIZE_MENU);
 
       if (icon_pos == GTK_ENTRY_ICON_PRIMARY)
         {